using System;
namespace SilverSea.Video.Tools
{
	public static class Untils
	{
		public static long DateDiff(DateInterval interval, DateTime date1, DateTime date2)
		{
			TimeSpan timeSpan = date2 - date1;
			switch (interval)
			{
			case DateInterval.Year:
				return (long)(date2.Year - date1.Year);
			case DateInterval.Month:
				return (long)(date2.Month - date1.Month + 12 * (date2.Year - date1.Year));
			case DateInterval.Weekday:
				return Untils.smethod_0(timeSpan.TotalDays) / 7L;
			case DateInterval.Day:
				return Untils.smethod_0(timeSpan.TotalDays);
			case DateInterval.Hour:
				return Untils.smethod_0(timeSpan.TotalHours);
			case DateInterval.Minute:
				return Untils.smethod_0(timeSpan.TotalMinutes);
			default:
				return Untils.smethod_0(timeSpan.TotalSeconds);
			}
		}
		private static long smethod_0(double double_0)
		{
			if (double_0 >= 0.0)
			{
				return (long)Math.Floor(double_0);
			}
			return (long)Math.Ceiling(double_0);
		}
	}
}
